package com.yuan.dao.merchant.impl;

import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import com.yuan.dao.merchant.MerchantDao;
import com.yuan.merchant.Merchant;

public class MerchantDaoImpl  extends SqlMapClientTemplate implements MerchantDao{

	public void save(Merchant merchant) throws SQLException {
		try{
		this.insert("Merchant.save", merchant);
		}catch(Exception ex){
			logger.error("Merchant入库失败", ex);
			throw new SQLException();
		}
	}

	public Merchant readById(Integer id) throws SQLException {
		
		Map<String, Object> args = new HashMap<String, Object>();
		args.put("id", id);

		return (Merchant) this.queryForObject("Merchant.readById", args);
		
	}


}
